package com.lc.user.express.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.user.express.R;
import com.lc.user.express.app.AppContext;
import com.lc.user.express.model.MyStardModel;

import java.util.List;

/**
 * Created by Administrator on 2016/4/1.
 */
public class StardAdapter extends BaseListAdapter<MyStardModel> {

    public StardAdapter(Context context, List<MyStardModel> data) {
        super(context, data);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHodler viewHodler = null;
        MyStardModel myStardModel = data.get(position);
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_list2_stardand, null);
            AppContext.ScaleScreenHelper.loadView((ViewGroup) convertView);
            viewHodler = new ViewHodler();
            viewHodler.tv4_stardand_item = (TextView) convertView.findViewById(R.id.tv4_stardand_item);
            viewHodler.tv5_stardand_item = (TextView) convertView.findViewById(R.id.tv5_stardand_item);
            convertView.setTag(viewHodler);
        }
        setContextView(convertView, myStardModel);
        return convertView;
    }

    private void setContextView(View convertView, MyStardModel myStardModel) {
        ViewHodler viewHodler = (ViewHodler) convertView.getTag();
        viewHodler.tv4_stardand_item.setText(myStardModel.getTv4_stardand_item());
        viewHodler.tv5_stardand_item.setText(myStardModel.getTv5_stardand_item());
    }

    public class ViewHodler {
        TextView tv4_stardand_item;
        TextView tv5_stardand_item;
    }
}
